<?php
/**
 * Yotaku shop - yshop
 * Copyright (c) 2016 http://www.yotaku.cn All rights reserved.
 * Author: Creatint <creatint@163.com> <http://creatint.yotaku.cn>
 */
namespace Addons\Second\Controller;
use Home\Controller\AddonsController;
use Addons\Second\SecondAddon;
use Home\Model\GoodsModel;
class SecondController extends AddonsController{
    //获取商品剩余数量
    public function getRemain(){
        $Second = D("Addons://Second/Second");

        //实例化插件类
        $Addons = new SecondAddon();

        //实例化商品模型
        $GoodsModel = new  GoodsModel();

        if($_GET['goods_id']>0){
            $goods = $GoodsModel->activity_info($_GET['goods_id'], $field = "id,price");
            //ajax返回
            $this->ajaxReturn($goods);
        }else{
            //模拟首页标签获取商品数据
            $goodss = $GoodsModel->activity($act=1, $category = null, $limit = 3, $field = "id,price");
            //ajax返回
            $this->ajaxReturn($goodss);
        }

    }
}